package com.example.springdemo.ioc;

import java.util.Scanner;

public class NewCarExample {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int size = sc.nextInt();
        Car car = new Car();
        car.init(size);
    }
    /**
     * 汽⻋对象
     */
    static class Car {
        public void init(int size) {
// 依赖⻋身
            Framework framework = new Framework();
            framework.init(size);
        }
    }
    /**
     * ⻋身类
     */
    static class Framework {
        public void init(int size) {
// 依赖底盘
            Bottom bottom = new Bottom();
            bottom.init(size);
        }
    }
    /**
     * 底盘类
     */
    static class Bottom {
        public void init(int size) {
// 依赖轮胎
            Tire tire = new Tire();
            tire.init(size);
        }
    }
    /**
     * 轮胎类
     */
    static class Tire {
//        private int size = 30;
        public void init(int size) {
            System.out.println("轮胎尺⼨：" + size);
        }
    }
}
